<template>
  <div :class="{'has-logo':showLogo}">
    <el-scrollbar wrap-class="scrollbar-wrapper">
      <el-menu
        :default-active="activeMenu"
        :collapse="false"
        :background-color="variables.menuBg"
        :text-color="variables.menuText"
        :unique-opened="false"
        :active-text-color="variables.menuActiveText"
        :collapse-transition="false"
        mode="vertical"
      >
        <sidebar-item v-for="(route,i) in permission_routes" :key="i" :item="route" :base-path="route.path" />
      </el-menu>
    </el-scrollbar>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss'

export default {
  components: { SidebarItem },
  computed: {
    ...mapGetters([
      'permission_routes',
      'sidebar'
    ]),
    activeMenu() {
      const route = this.$route
      const { meta, path } = route
      // if set path, the sidebar will highlight the path you set
      if (meta.activeMenu) {
        return meta.activeMenu
      }
      return path
    },
    showLogo() {
      return this.$store.state.settings.sidebarLogo
    },
    variables() {
      return variables
    },
    isCollapse() {
      return !this.sidebar.opened
    }
  },
  // 页面挂载完时
  created() {
    // this.msgPupop()
  },
  methods: {
    msgPupop() {
      this.$notify.info({
        title: '提示',
        customClass: 'dashboardInfo',
        duration: 50000,
        message: '您有待办案件8件，即将过期案件5件，已过期3件，请及时处理!',
        position: 'bottom-right'
      })
    }
  }
}
</script>
<style lang="scss">

.current-menu-panel{
  height: 50px;
  display: flex;
  padding: 0px 20px;
  .current-menu-icon{
    color: #ec4328;
    width: 40px;
    font-size: 36px;
  }
  .current-menu-message{
    width: 130px;
    p{
      color: #cfcfcf;
      font-size: 12px;
      margin: 0px;
      line-height: 20px;
      overflow: hidden;
      &:first-child{
        color: #1890ff;
        font-weight: 500;
        font-size: 14px;
      }
    }

  }
}
</style>
